PROCEDURE TForm4.TestShlWAPIMLLoadLibrary(Sender : TObject);
//See doc. on function in Ms SDK version 6.0 and revise function declaration !!!
VAR loadedcodedllname : STRING;
VAR resdllname : STRING;
VAR loadedcodedllh : HMODULE;
VAR crosscodepg : DWORD;
//VAR resmoduleh : HMODULE;
VAR resmodulefilename : ARRAY[0 .. 259] OF CHAR;
VAR bufsize : DWORD;
VAR newinfoline : STRING;
BEGIN
//ShowMessage('MLLoadLibrary');
loadedcodedllname := '';
resdllname := '';
loadedcodedllh := 0;
crosscodepg := 0;
//resmoduleh := 0;
bufsize := 0;
bufsize := Length(resmodulefilename);
FillChar(resmodulefilename, bufsize, #0);
newinfoline := '';
loadedcodedllname := 'Shell32.dll';
loadedcodedllh := GetModuleHandle(PChar(loadedcodedllname));
resdllname := loadedcodedllname;
newinfoline := 'MLLoadLibrary called with ' + resdllname + ' and mddule handle 0x' +
IntToHex(loadedcodedllh, 8) + ' for ' + loadedcodedllname + ' returned : ';
Memo1.Lines.Add(newinfoline);
//fmlresmoduleh := MLLoadLibrary('Shell32.dll', loadedcodedllh, crosscodepg);
fmlresmoduleh := MLLoadLibrary(PChar(resdllname), loadedcodedllh, crosscodepg);
newinfoline := 'fmlresmoduleh = 0x' + IntToHex(fmlresmoduleh, 8) + ' (' + IntToStr(fmlresmoduleh) + ') ';
IF (fmlresmoduleh <> 0) AND (fmlresmoduleh <> INVALID_HANDLE_VALUE) THEN
BEGIN
GetModuleFileName(fmlresmoduleh, resmodulefilename, bufsize);
newinfoline := newinfoline + ' ("' + resmodulefilename + '")';
Memo1.Lines.Add(newinfoline);
TestShlWAPIMLFreeLibrary(Sender);
END
ELSE
Memo1.Lines.Add(newinfoline);
loadedcodedllname := 'MMX32.dll';
loadedcodedllh := GetModuleHandle(PChar(loadedcodedllname));
resdllname := loadedcodedllname + '.mui';
newinfoline := 'MLLoadLibrary called with ' + resdllname + ' and mddule handle 0x' +
IntToHex(loadedcodedllh, 8) + ' for ' + loadedcodedllname + ' returned : ';
Memo1.Lines.Add(newinfoline);
//fmlresmoduleh := MLLoadLibrary('MMX32.dll.mui', loadedcodedllh, crosscodepg);
fmlresmoduleh := MLLoadLibrary(PChar(resdllname), loadedcodedllh, crosscodepg);
newinfoline := 'fmlresmoduleh = 0x' + IntToHex(fmlresmoduleh, 8) + ' (' + IntToStr(fmlresmoduleh) + ') ';
IF (fmlresmoduleh <> 0) AND (fmlresmoduleh <> INVALID_HANDLE_VALUE) THEN
BEGIN
GetModuleFileName(fmlresmoduleh, resmodulefilename, bufsize);
newinfoline := newinfoline + ' ("' + resmodulefilename + '")';
Memo1.Lines.Add(newinfoline);
TestShlWAPIMLFreeLibrary(Sender);
END
ELSE
Memo1.Lines.Add(newinfoline);
loadedcodedllname := 'moricons.dll';
loadedcodedllh := GetModuleHandle(PChar(loadedcodedllname));
resdllname := loadedcodedllname;
newinfoline := 'MLLoadLibrary called with ' + resdllname + ' and mddule handle 0x' +
IntToHex(loadedcodedllh, 8) + ' for ' + loadedcodedllname + ' returned : ';
Memo1.Lines.Add(newinfoline);
//fmlresmoduleh := MLLoadLibrary('moricons.dll', loadedcodedllh, crosscodepg);
fmlresmoduleh := MLLoadLibrary(PChar(resdllname), loadedcodedllh, crosscodepg);
newinfoline := 'fmlresmoduleh = 0x' + IntToHex(fmlresmoduleh, 8) + ' (' + IntToStr(fmlresmoduleh) + ') ';
IF (fmlresmoduleh <> 0) AND (fmlresmoduleh <> INVALID_HANDLE_VALUE) THEN
BEGIN
GetModuleFileName(fmlresmoduleh, resmodulefilename, bufsize);
newinfoline := newinfoline + ' ("' + resmodulefilename + '")';
Memo1.Lines.Add(newinfoline);
TestShlWAPIMLFreeLibrary(Sender);
END
ELSE
Memo1.Lines.Add(newinfoline);
loadedcodedllname := 'IEFrame.dll';
loadedcodedllh := GetModuleHandle(PChar(loadedcodedllname));
resdllname := loadedcodedllname;
newinfoline := 'MLLoadLibrary called with ' + resdllname + ' and mddule handle 0x' +
IntToHex(loadedcodedllh, 8) + ' for ' + loadedcodedllname + ' returned : ';
Memo1.Lines.Add(newinfoline);
//fmlresmoduleh := MLLoadLibrary('IEFrame.dll', loadedcodedllh, crosscodepg);
fmlresmoduleh := MLLoadLibrary(PChar(resdllname), loadedcodedllh, crosscodepg);
newinfoline := 'fmlresmoduleh = 0x' + IntToHex(fmlresmoduleh, 8) + ' (' + IntToStr(fmlresmoduleh) + ') ';
IF (fmlresmoduleh <> 0) AND (fmlresmoduleh <> INVALID_HANDLE_VALUE) THEN
BEGIN
GetModuleFileName(fmlresmoduleh, resmodulefilename, bufsize);
newinfoline := newinfoline + ' ("' + resmodulefilename + '")';
Memo1.Lines.Add(newinfoline);
TestShlWAPIMLFreeLibrary(Sender);
END
ELSE
Memo1.Lines.Add(newinfoline);
loadedcodedllname := 'comdlg32.dll';
loadedcodedllh := GetModuleHandle(PChar(loadedcodedllname));
resdllname := 'NIL';
newinfoline := 'MLLoadLibrary called with ' + resdllname + ' and mddule handle 0x' +
IntToHex(loadedcodedllh, 8) + ' for ' + loadedcodedllname + ' returned : ';
Memo1.Lines.Add(newinfoline);
fmlresmoduleh := MLLoadLibrary(NIL, loadedcodedllh, crosscodepg);
//fmlresmoduleh := MLLoadLibrary('', loadedcodedllh, crosscodepg); //Produces the same result as the previous line !!!
newinfoline := 'fmlresmoduleh = 0x' + IntToHex(fmlresmoduleh, 8) + ' (' + IntToStr(fmlresmoduleh) + ') ';
IF (fmlresmoduleh <> 0) AND (fmlresmoduleh <> INVALID_HANDLE_VALUE) THEN
BEGIN
GetModuleFileName(fmlresmoduleh, resmodulefilename, bufsize);
newinfoline := newinfoline + ' ("' + resmodulefilename + '")';
Memo1.Lines.Add(newinfoline);
TestShlWAPIMLFreeLibrary(Sender);
END
ELSE
Memo1.Lines.Add(newinfoline);
loadedcodedllname := 'comdlg32.dll';
loadedcodedllh := 0;
resdllname := loadedcodedllname;
newinfoline := 'MLLoadLibrary called with ' + resdllname + ' and mddule handle 0x' +
IntToHex(loadedcodedllh, 8) + ' for ' + loadedcodedllname + ' returned : ';
Memo1.Lines.Add(newinfoline);
//fmlresmoduleh := MLLoadLibrary('comdlg32.dll', loadedcodedllh, crosscodepg);
fmlresmoduleh := MLLoadLibrary(PChar(resdllname), loadedcodedllh, crosscodepg);
newinfoline := 'fmlresmoduleh = 0x' + IntToHex(fmlresmoduleh, 8) + ' (' + IntToStr(fmlresmoduleh) + ') ';
IF (fmlresmoduleh <> 0) AND (fmlresmoduleh <> INVALID_HANDLE_VALUE) THEN
BEGIN
GetModuleFileName(fmlresmoduleh, resmodulefilename, bufsize);
newinfoline := newinfoline + ' ("' + resmodulefilename + '")';
Memo1.Lines.Add(newinfoline);
TestShlWAPIMLFreeLibrary(Sender);
END
ELSE
Memo1.Lines.Add(newinfoline);
loadedcodedllname := 'comdlg32.dll';
loadedcodedllh := GetModuleHandle(PChar(loadedcodedllname));
resdllname := loadedcodedllname;
newinfoline := 'MLLoadLibrary called with ' + resdllname + ' and module handle 0x' +
IntToHex(loadedcodedllh, 8) + ' for ' + loadedcodedllname + ' returned : ';
Memo1.Lines.Add(newinfoline);
//fmlresmoduleh := MLLoadLibrary('comdlg32.dll', loadedcodedllh, crosscodepg);
fmlresmoduleh := MLLoadLibrary(PChar(resdllname), loadedcodedllh, crosscodepg);
newinfoline := 'fmlresmoduleh = 0x' + IntToHex(fmlresmoduleh, 8) + ' (' + IntToStr(fmlresmoduleh) + ') ';
IF (fmlresmoduleh <> 0) AND (fmlresmoduleh <> INVALID_HANDLE_VALUE) THEN
BEGIN
GetModuleFileName(fmlresmoduleh, resmodulefilename, bufsize);
newinfoline := newinfoline + ' ("' + resmodulefilename + '")';
Memo1.Lines.Add(newinfoline);
TestShlWAPIMLFreeLibrary(Sender);
END
ELSE
Memo1.Lines.Add(newinfoline);
loadedcodedllname := 'comdlg32.dll';
loadedcodedllh := 0;
resdllname := loadedcodedllname + '.mui';
newinfoline := 'MLLoadLibrary called with ' + resdllname + ' and mddule handle 0x' +
IntToHex(loadedcodedllh, 8) + ' for ' + loadedcodedllname + ' returned : ';
Memo1.Lines.Add(newinfoline);
//fmlresmoduleh := MLLoadLibrary('comdlg32.dll.mui', loadedcodedllh, crosscodepg);
fmlresmoduleh := MLLoadLibrary(PChar(resdllname), loadedcodedllh, crosscodepg);
newinfoline := 'fmlresmoduleh = 0x' + IntToHex(fmlresmoduleh, 8) + ' (' + IntToStr(fmlresmoduleh) + ') ';
IF (fmlresmoduleh <> 0) AND (fmlresmoduleh <> INVALID_HANDLE_VALUE) THEN
BEGIN
GetModuleFileName(fmlresmoduleh, resmodulefilename, bufsize);
newinfoline := newinfoline + ' ("' + resmodulefilename + '")';
Memo1.Lines.Add(newinfoline);
TestShlWAPIMLFreeLibrary(Sender);
END
ELSE
Memo1.Lines.Add(newinfoline);
loadedcodedllname := 'comdlg32.dll';
loadedcodedllh := GetModuleHandle(PChar(loadedcodedllname));
resdllname := loadedcodedllname + '.mui';
newinfoline := 'MLLoadLibrary called with ' + resdllname + ' and module handle 0x' +
IntToHex(loadedcodedllh, 8) + ' for ' + loadedcodedllname + ' returned : ';
Memo1.Lines.Add(newinfoline);
//fmlresmoduleh := MLLoadLibrary('comdlg32.dll.mui', loadedcodedllh, crosscodepg);
fmlresmoduleh := MLLoadLibrary(PChar(resdllname), loadedcodedllh, crosscodepg);
newinfoline := 'fmlresmoduleh = 0x' + IntToHex(fmlresmoduleh, 8) + ' (' + IntToStr(fmlresmoduleh) + ') ';
IF (fmlresmoduleh <> 0) AND (fmlresmoduleh <> INVALID_HANDLE_VALUE) THEN
BEGIN
GetModuleFileName(fmlresmoduleh, resmodulefilename, bufsize);
newinfoline := newinfoline + ' ("' + resmodulefilename + '")';
Memo1.Lines.Add(newinfoline);
TestShlWAPIMLFreeLibrary(Sender);
END
ELSE
Memo1.Lines.Add(newinfoline);
Memo1.Lines.Add('');
END; |